<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>正则表达式</title>
</head>
<body>
<script>
    console.log(/\^abc/.test('^abc'));
    console.log( /(abc)\1/.test('^abcabc'));
    console.log(/(?:abc)(def)\1/.test('abcdefdef'));


    console.log("--------------");
    console.log( /(abc)/.exec('abcdef'));
    console.log( /(abc)/.test('abcdef'));
    console.log( /(abc)/.toString());
    var reg=/abc/;
    reg.compile("def");
    console.log(reg.test('def'));
    console.log("--------------");
    console.log("abcabcdef".search(/(abc)\1/));
    console.log("aabbbbcc".replace(/b+?/,"1"));
    console.log("aabbbbcc".match(/b+/));
    console.log("aabbbbccbbaa".match(/b+/g));
    console.log("aabbbbccbbaa".split(/b+/));



</script>
</body>
</html>